<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:shell="http://schemas.microsoft.com/winfx/2006/xaml/presentation/shell"
    xmlns:local="clr-namespace:CustomChromeLibrary"
    >

	<BitmapImage x:Key="MinimizeImage" UriSource="/CustomChromeLibrary;component/Images/minimize.jpg"/>
	
	<ControlTemplate x:Key="CaptionButtonTemplate" TargetType="{x:Type local:CaptionButton}">
		<Grid Height="20">
			<Border x:Name="ButtonBackground" 
                CornerRadius="{Binding Path=CornerRadius, RelativeSource={RelativeSource TemplatedParent}}" 
                Opacity="1" BorderThickness="0" Background="{TemplateBinding Background}">
				<Border>
					<Border.Background>
						<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
							<GradientStop Color="#ccffffff" Offset="0"/>
							<GradientStop Color="Transparent" Offset="1"/>
						</LinearGradientBrush>
					</Border.Background>
				</Border>
			</Border>

			<Border x:Name="ButtonEdgesBorder" CornerRadius="{Binding Path=CornerRadius, RelativeSource={RelativeSource TemplatedParent}}" Opacity="1" BorderBrush="Black" BorderThickness="{TemplateBinding BorderThickness}">
				<Border.BitmapEffect>
					<DropShadowBitmapEffect Color="#FFFFFFFF" Direction="270" ShadowDepth=".75" Softness="0.20"/>
				</Border.BitmapEffect>
			</Border>

			<!--<Border x:Name="ButtonContentBorder" CornerRadius="{Binding Path=CornerRadius, RelativeSource={RelativeSource TemplatedParent}}" Opacity="1" BorderThickness="1">
                <ContentPresenter Width="Auto" Height="Auto"  HorizontalAlignment="Center" VerticalAlignment="Center"></ContentPresenter>
            </Border>-->

			<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>

		</Grid>

		<ControlTemplate.Triggers>
			<Trigger Property="IsMouseOver" Value="True">
				<Setter TargetName="ButtonBackground" Property="Background" Value="{Binding Path=HoverBackground, RelativeSource={RelativeSource TemplatedParent}}"/>
			</Trigger>
			<Trigger Property="IsPressed" Value="true">
				<Setter TargetName="ButtonBackground" Property="Background" Value="{Binding Path=PressedBackground, RelativeSource={RelativeSource TemplatedParent}}"/>
			</Trigger>
		</ControlTemplate.Triggers>
	</ControlTemplate>

	<ControlTemplate x:Key="MinimizeButtonTemplate" TargetType="{x:Type local:MinimizeButton}" >
		<Image Source="/CustomChromeLibrary;component/Images/minimize.jpg" Width="12" Margin="0,4,0,0"/>
	</ControlTemplate>

	<Style TargetType="{x:Type local:WindowIcon}">
		<Setter Property="shell:WindowChrome.IsHitTestVisibleInChrome" Value="True"/>
		<Setter Property="SnapsToDevicePixels" Value="True"/>
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="{x:Type local:WindowIcon}">
					<Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
					</Border>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="{x:Type local:CaptionButton}" x:Key="CaptionButtonStyle">
		<Setter Property="Background" Value="#000055"/>
		<Setter Property="HoverBackground" Value="#0000cc"/>
		<Setter Property="PressedBackground" Value="#000033"/>
		<Setter Property="Foreground" Value="White" />
		<Setter Property="FontFamily" Value="Lucida Console" />
		<Setter Property="FontWeight" Value="Bold" />
		<Setter Property="FontSize" Value="13" />
		<Setter Property="Width" Value="28"/>
		<Setter Property="Height" Value="20" />
		<Setter Property="shell:WindowChrome.IsHitTestVisibleInChrome" Value="True"/>
		<Setter Property="Template" Value="{StaticResource CaptionButtonTemplate}" />
	</Style>

	<Style TargetType="{x:Type local:HelpButton}" BasedOn="{StaticResource CaptionButtonStyle}" x:Shared="False">
		<Setter Property="BorderThickness" Value="1,1,0,1"/>
		<Setter Property="CornerRadius" Value="0,0,0,4"/>
		<Setter Property="Foreground" Value="White" />
		<Setter Property="FontFamily" Value="Lucida Console" />
		<Setter Property="FontWeight" Value="Bold" />
		<Setter Property="FontSize" Value="13" />
		<Setter Property="Content" Value="?"/>
	</Style>

	<Style TargetType="{x:Type local:MinimizeButton}" BasedOn="{StaticResource CaptionButtonStyle}" x:Shared="False">
		<Setter Property="Button.Content">
			<Setter.Value>
				<Image Source="/CustomChromeLibrary;component/Images/minimize.jpg" Width="12" Margin="0,4,0,0"/>
			</Setter.Value>
		</Setter>
		<Setter Property="BorderThickness" Value="1,1,1,1"/>
		<Setter Property="CornerRadius" Value="0,0,0,4"/>
	</Style>

	<Style TargetType="{x:Type local:MaximizeButton}" BasedOn="{StaticResource CaptionButtonStyle}" x:Shared="False">
		<Setter Property="BorderThickness" Value="0,1,1,1"/>
		<Setter Property="Content">
			<Setter.Value>
				<Grid>
					<Image Source="/CustomChromeLibrary;component/Images/maximize.png" Width="12" Visibility="{Binding MaximizeIconVisibility}"/>
					<Image Source="/CustomChromeLibrary;component/Images/restore.png" Width="12" Visibility="{Binding RestoreIconVisibility}"/>
				</Grid>
			</Setter.Value>
		</Setter>
	</Style>

	<Style TargetType="{x:Type local:CloseButton}" BasedOn="{StaticResource CaptionButtonStyle}" x:Shared="False">
		<Setter Property="Background" Value="#770000"/>
		<Setter Property="HoverBackground" Value="#cc0000"/>
		<Setter Property="PressedBackground" Value="#440000"/>
		<Setter Property="Width" Value="46"/>
		<Setter Property="Margin" Value="0,0,11,0"/>
		<Setter Property="BorderThickness" Value="0,1,1,1"/>
		<Setter Property="CornerRadius" Value="0,0,4,0"/>
		<Setter Property="Content">
			<Setter.Value>
				<Image Source="/CustomChromeLibrary;component/Images/close.png" Width="11"/>
			</Setter.Value>
		</Setter>
	</Style>

</ResourceDictionary>
